<%
columns = @available_columns
href = url_for(params_for(:action => :index, :escape => false))
-%>
<%= form_remote_tag :url => href,
                    :method => :get,
                    :before => "addActiveScaffoldPageToHistory('#{href}', '#{params[:controller]}')",
                    :after => "$('#{loading_indicator_id(:action => :config_list, :id => params[:id])}').style.visibility = 'visible'; Form.disable('#{controller_id}-config_list-form');",
                    :complete => "$('#{loading_indicator_id(:action => :config_list, :id => params[:id])}').style.visibility = 'hidden'; Form.enable('#{controller_id}-config_list-form');",
                    :failure => "ActiveScaffold.report_500_response('#{active_scaffold_id}')",
                    :html => { :href => href, :id => "#{controller_id}-config_list-form", :class => 'config_list' } %>

<h4>Configura colonne visibili</h4>

<div class="columns checkbox-list">
  <% columns.each do |c| %>
    <div class="column checkbox-wrapper">
      <%= content_tag(:label, check_box_tag(c[:param_name], 1, @columns.include?(c[:name]) ) + c[:label] ) %>
  </div>
<% end %>  
</div>

<div class="separator"></div>

<div>
  <p class="form-footer">
  | <%= link_to as_('Valori predefiniti'), :commit => "reset_to_default" %>
  | <%= link_to as_('Mostra tutte le colonne'), :commit => "show_all_columns" %>
  |
  </p>
</div>

<div class="separator"></div>

<div>
  <p class="form-footer">
    <%= submit_tag as_(:ok), :class => "submit" %>
    <%= link_to as_(:cancel), params_for(:action => 'list'), :class => 'cancel' %>
    <%= loading_indicator_tag(:action => :config_list) %>
  </p>
</div>

</form>

<script type="text/javascript">
//<![CDATA[
  //Form.focusFirstElement('<%= "#{controller_id}-config_list-form" -%>');
//]]>
</script>
